%{
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
void yyerror(char *);
#include "tiny_y.h"
 char buffer[50];
%}

LETTER  [A-Za-z_]
DIGIT   [0-9]
IDENT   {LETTER}({DIGIT}|{LETTER})*
INTEGER {DIGIT}+

%%
"if"      { return IF;}
"else"    { return ELSE;}
"print"   { return PRINT;}
{INTEGER} {
            yylval.iValue=atoi(yytext);
            return INT;
          }
{IDENT}   { 
            strcpy(buffer,yytext);
	     	yylval.istring=buffer;
        	return ID;
          }
"//".*    ;
[-+/*();={}]   return *yytext;
[ \t\n]    ;
.         {yyerror("invalid character"); printf(" %c\n",*yytext);}
%%
int yywrap(void){
  return 1;
}
